<template>
    <div>
        <el-form-item label="投放时段">
            <el-radio-group v-model="dataForm.adgroup.delivery[dataForm.delivery_index].dayparting_type" size="small" @change="changeDayparting">
                <el-radio-button :label="1">全天</el-radio-button>
                <el-radio-button :label="0">指定时间段</el-radio-button>
            </el-radio-group>
        </el-form-item>
        <TimeSlot v-if="dataForm.adgroup.delivery[dataForm.delivery_index].dayparting_type == 0" :dataForm="dataForm" v-model="dataForm.adgroup.delivery[dataForm.delivery_index].dayparting" @change="sessionSave" />
    </div>
</template>

<script>
import TimeSlot from "./TimeSlot";
export default {
    props: ["dataForm"],
    components: {
        TimeSlot,
    },
    name: "",
    data() {
        return {};
    },
    created() {},
    methods: {
        sessionSave() {
            this.$emit("sessionSave");
        },

        changeDayparting() {
            let all_0 =
                "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
            if (this.dataForm.adgroup.delivery[this.dataForm.delivery_index].dayparting_type == 1) {
                this.dataForm.adgroup.delivery[
                    this.dataForm.delivery_index
                ].dayparting = all_0;
            }
            this.sessionSave();
        },
    },
};
</script>


<style scoped>
</style>

